#include "expression.h"

expression::expression(
    int expr_id,
    const char *op_name,
    const char *op_type,
    int *inputs,
    int num_inputs) : expr_id_temp(expr_id), op_name_temp(op_name), op_type_temp(op_type),
    inputs_temp(inputs, inputs + num_inputs)
{
}

void expression::add_op_param_double(
    const char *key,
    double value)
{
//    std::cout << "========add_op_param_double \n" << *key << std::endl;
    const char *w = "weight";
    const char *b = "bias";
    const char *k = "kernel_size";
    const char *s = "stride";
    const char *i = "in_channels";
    const char *o = "out_channels";

    if((*key) == (*w)|| (*key) == (*b) ){
        exp_value[key] = test(value);
    }else if ((*key) == (*k)|| (*key) == (*s)||(*key) == (*i)||(*key) == (*o)){
        exp_ker_str[key] = value;
    }else{
        temp = test(value);
    }

}

void expression::add_op_param_ndarray(
    const char *key,
    int dim,
    size_t shape[],
    double data[])
{
//    std::cout << "========add_op_param_ndarray \n" << *key << std::endl;
    const char *w = "weight";
    const char *b = "bias";

    if((*key) == (*w)|| (*key) == (*b) ){
        exp_value[key] = test(dim, shape, data);
    }else{
        temp = test(dim, shape, data);
    }
}